<template lang="html">
  <div class="getGoodsBox">
    <el-row>
      <el-col :span="2">
        <span>开始时间:</span>
      </el-col>
      <el-col :span="4">
        <el-date-picker
           v-model="startTime"
           size="small"
           type="date"
           placeholder="选择日期">
         </el-date-picker>
      </el-col>
    </el-row>
    <el-row style="margin:10px 0;">
      <el-col :span="2">
        <span>结束时间:</span>
      </el-col>
      <el-col :span="4">
        <el-date-picker
           v-model="endTime"
           size="small"
           type="date"
           placeholder="选择日期">
         </el-date-picker>
      </el-col>
    </el-row>
    <el-row class="text-right">
      <el-button type="success" size="small" @click="sub">拉取订单</el-button>
    </el-row>
  </div>
</template>

<script>
import axios from "axios"
var url;

export default {
  data(){
    return {
      startTime:'',
      endTime:'',

    }
  },
  methods:{
    sub:function (){
      var that = this;
      var star=that.startTime.getTime();
      var end=that.endTime.getTime();
      that.$store.dispatch('closeDialog','TanGoods');
      axios.get('https://dev.hupovip.cn/hpserver/v1/yz/sync/orders',{
        params:{
          startTime:star,
          endTime:end
        }
      }).then((res)=>{
        if(res.data.code==1){
          that.$message({
             showClose: true,
             message: '成功',
             type: 'error'
           });
        }else{
          that.$message({
             showClose: true,
             message: res.data.msg,
             type: 'error'
           });
        }
      }).catch((err)=>{

      })
    }
  },
  created(){
    url=this.$store.state.url;
  }
}
</script>

<style lang="Sass">
  .getGoodsBox{line-height: 30px;
    span{font-size: 13px;}
  }
</style>
